package cj.web.marry.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;

@DAO
public interface YYBookingDAO {
	//----------------预约信息
	@SQL("SELECT * FROM YYBooking WHERE deleteFlag=1 AND buyerId=:3 ORDER BY updateAt DESC LIMIT :1,:2 ")
    List<Map> queryBooking(int start,int length,int buyerId);
	
	@SQL("SELECT count(1) FROM YYBooking WHERE deleteFlag=1 AND buyerId=:1 ")
    int queryBookingsize(int buyerId);
    
    @SQL("SELECT * FROM YYBooking WHERE id=:1 ")
    List<Map> queryBookingById(int id);
    
    @ReturnGeneratedKeys
    @SQL("INSERT INTO YYBooking (id,buyerId,businessId,businessType,name,phone,bookingAt,state,deleteFlag,createAt,createUser,updateAt,updateUser) VALUES (0,:1,:2,:3,:4,:5,:6,:7,1,now(),:8,now(),:9)")
    int create(int buyerId,int businessId,int businessType,String name,String phone,String bookingAt,int state,String createUser,String updateUser);
	
	//----------------婚庆商品信息
	@SQL("SELECT id,productName,sellerName,img,price,tel,address,type FROM YYWeddingCelebration WHERE deleteFlag=1 AND state=1 #if(:3 != 99){ AND type =:3 } ORDER BY updateAt DESC LIMIT :1,:2 ")
    List<Map> queryWeddingCelebration(int start,int length,int type);
	
	@SQL("SELECT count(1) FROM YYWeddingCelebration WHERE deleteFlag=1 AND state=1 #if(:1 != 99 ){ AND type =:1 } ")
    int queryWeddingCelebrationsize(int type);
	
	@SQL("SELECT * FROM YYWeddingCelebration WHERE deleteFlag=1 AND state=1 AND id=:1")
	List<Map> queryWeddingCelebrationById(int id);
	
	//----------------婚宴商家信息
	@SQL("SELECT * FROM YYWeddingFeast WHERE deleteFlag=1 AND state=1 #if(:3!=''){ AND area =:3 }  ORDER BY updateAt DESC LIMIT :1,:2 ")
    List<Map> queryWeddingFeast(int start,int length,String area);
	
	@SQL("SELECT count(1) FROM YYWeddingFeast WHERE deleteFlag=1 AND state=1 #if(:1!=''){ AND area =:1 } ")
    int queryWeddingFeastsize(String area);
	
	@SQL("SELECT * FROM YYWeddingFeast WHERE deleteFlag=1 AND state=1 AND id=:1")
	List<Map> queryWeddingFeastById(int id);
	
	//----------------婚纱照商家信息
	@SQL("SELECT * FROM YYWeddingPhoto WHERE deleteFlag=1 AND state=1 #if(:3!=''){ AND area =:3 } ORDER BY updateAt DESC LIMIT :1,:2 ")
    List<Map> queryWeddingPhoto(int start,int length,String area);
	
	@SQL("SELECT count(1) FROM YYWeddingPhoto WHERE deleteFlag=1 AND state=1 #if(:1!=''){ AND area =:1 } ")
    int queryWeddingPhotosize(String area);
	
	@SQL("SELECT * FROM YYWeddingPhoto WHERE deleteFlag=1 AND state=1 AND id=:1 ")
	List<Map> queryWeddingPhotoById(int id);
	
	//----------------商家预约信息
	@SQL("SELECT * FROM YYBusinessRes WHERE deleteFlag=1 AND state=1 #if(:3!=''){ AND area =:3 } ORDER BY stickAt DESC,updateAt DESC LIMIT :1,:2 ")
    List<Map> queryYYBusinessRes(int start,int length,String area);
	
	@SQL("SELECT count(1) FROM YYBusinessRes WHERE deleteFlag=1 AND state=1 #if(:1!=''){ AND area =:1 } ")
    int queryYYBusinessRessize(String area);
	
	@SQL("SELECT * FROM YYBusinessRes WHERE deleteFlag=1 AND state=1 AND id=:1 ")
	List<Map> queryYYBusinessResById(int id);
}